/*     */ package com.umeng.analytics.onlineconfig;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.SharedPreferences;
/*     */ import android.content.SharedPreferences.Editor;
/*     */ import android.text.TextUtils;
/*     */ import com.umeng.analytics.g;
/*     */ import com.umeng.analytics.j;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.net.s;
/*     */ import com.umeng.common.net.t;
/*     */ import com.umeng.common.util.h;
/*     */ import java.util.Iterator;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class a
/*     */ {
/*  26 */   private final String a = "last_config_time";
/*  27 */   private final String b = "report_policy";
/*     */ 
/*  29 */   private final String c = "online_config";
/*     */ 
/*  31 */   private String d = null;
/*  32 */   private String e = null;
/*     */ 
/*  35 */   private UmengOnlineConfigureListener f = null;
/*  36 */   private c g = null;
/*     */ 
/*     */   public void a(Context paramContext)
/*     */   {
/*     */     try
/*     */     {
/*  46 */       if (paramContext == null) {
/*  47 */         Log.b("MobclickAgent", "unexpected null context in updateOnlineConfig");
/*  48 */         return;
/*     */       }
/*     */ 
/*  51 */       new Thread(new b(paramContext)).start();
/*     */     }
/*     */     catch (Exception localException) {
/*  54 */       Log.b("MobclickAgent", "exception in updateOnlineConfig");
/*     */     }
/*     */   }
/*     */ 
/*     */   public void a(Context paramContext, String paramString1, String paramString2)
/*     */   {
/*  60 */     this.d = paramString1;
/*  61 */     this.e = paramString2;
/*     */ 
/*  63 */     a(paramContext);
/*     */   }
/*     */ 
/*     */   public void a(UmengOnlineConfigureListener paramUmengOnlineConfigureListener) {
/*  67 */     this.f = paramUmengOnlineConfigureListener;
/*     */   }
/*     */ 
/*     */   public void a() {
/*  71 */     this.f = null;
/*     */   }
/*     */ 
/*     */   public void a(c paramc) {
/*  75 */     this.g = paramc;
/*     */   }
/*     */ 
/*     */   public void b() {
/*  79 */     this.g = null;
/*     */   }
/*     */ 
/*     */   private void a(JSONObject paramJSONObject) {
/*  83 */     if (this.f != null) this.f.onDataReceived(paramJSONObject); 
/*     */   }
/*     */ 
/*     */   private String b(Context paramContext) throws Exception {
/*  87 */     String str = this.d;
/*  88 */     if (str == null) {
/*  89 */       str = com.umeng.common.b.q(paramContext);
/*     */     }
/*     */ 
/*  92 */     if (str == null) {
/*  93 */       throw new Exception("none appkey exception");
/*     */     }
/*     */ 
/*  96 */     return str;
/*     */   }
/*     */ 
/*     */   private String c(Context paramContext) {
/* 100 */     return this.e == null ? com.umeng.common.b.u(paramContext) : this.e;
/*     */   }
/*     */ 
/*     */   private JSONObject d(Context paramContext)
/*     */   {
/* 105 */     JSONObject localJSONObject = new JSONObject();
/*     */     try {
/* 107 */       localJSONObject.put("type", "online_config");
/* 108 */       localJSONObject.put("appkey", b(paramContext));
/* 109 */       localJSONObject.put("version_code", com.umeng.common.b.d(paramContext));
/* 110 */       localJSONObject.put("package", com.umeng.common.b.v(paramContext));
/* 111 */       localJSONObject.put("sdk_version", "4.6.3");
/*     */ 
/* 113 */       localJSONObject.put("idmd5", h.b(com.umeng.common.b.g(paramContext)));
/* 114 */       localJSONObject.put("channel", c(paramContext));
/*     */ 
/* 116 */       int[] arrayOfInt = j.i(paramContext);
/* 117 */       localJSONObject.put("report_policy", arrayOfInt[0]);
/* 118 */       localJSONObject.put("last_config_time", e(paramContext));
/*     */     }
/*     */     catch (Exception localException) {
/* 121 */       Log.b("MobclickAgent", "exception in onlineConfigInternal");
/* 122 */       return null;
/*     */     }
/*     */ 
/* 125 */     return localJSONObject;
/*     */   }
/*     */ 
/*     */   private String e(Context paramContext)
/*     */   {
/* 130 */     SharedPreferences localSharedPreferences = j.b(paramContext);
/* 131 */     return localSharedPreferences.getString("umeng_last_config_time", "");
/*     */   }
/*     */ 
/*     */   private void a(Context paramContext, b paramb) {
/* 135 */     SharedPreferences localSharedPreferences = j.b(paramContext);
/* 136 */     SharedPreferences.Editor localEditor = localSharedPreferences.edit();
/*     */ 
/* 138 */     if (!TextUtils.isEmpty(paramb.e)) {
/* 139 */       localEditor.putString("umeng_last_config_time", paramb.e);
/*     */     }
/*     */ 
/* 142 */     if (paramb.c != -1)
/*     */     {
/* 144 */       localEditor.putInt("umeng_net_report_policy", paramb.c);
/* 145 */       localEditor.putLong("umeng_net_report_interval", paramb.d);
/*     */     }
/*     */ 
/* 149 */     localEditor.commit();
/*     */   }
/*     */ 
/*     */   private void b(Context paramContext, b paramb) {
/* 153 */     if ((paramb.a == null) || (paramb.a.length() == 0)) {
/* 154 */       return;
/*     */     }
/*     */ 
/* 157 */     SharedPreferences localSharedPreferences = j.b(paramContext);
/* 158 */     SharedPreferences.Editor localEditor = localSharedPreferences.edit();
/*     */     try
/*     */     {
/* 161 */       JSONObject localJSONObject = paramb.a;
/*     */ 
/* 164 */       Iterator localIterator = localJSONObject.keys();
/*     */ 
/* 166 */       while (localIterator.hasNext()) {
/* 167 */         String str = (String)localIterator.next();
/* 168 */         localEditor.putString(str, localJSONObject.getString(str));
/*     */       }
/*     */ 
/* 171 */       localEditor.commit();
/*     */ 
/* 173 */       Log.a("MobclickAgent", "get online setting params: " + localJSONObject);
/*     */     }
/*     */     catch (Exception localException) {
/* 176 */       Log.c("MobclickAgent", "save online config params", localException);
/*     */     }
/*     */   }
/*     */ 
/*     */   public class a extends t
/*     */   {
/*     */     private JSONObject e;
/*     */ 
/*     */     public a(JSONObject arg2)
/*     */     {
/* 245 */       super();
/*     */       Object localObject;
/* 246 */       this.e = localObject;
/*     */     }
/*     */ 
/*     */     public JSONObject a()
/*     */     {
/* 253 */       return this.e;
/*     */     }
/*     */ 
/*     */     public String b()
/*     */     {
/* 259 */       return this.d;
/*     */     }
/*     */   }
/*     */ 
/*     */   public class b extends s
/*     */     implements Runnable
/*     */   {
/*     */     Context a;
/*     */ 
/*     */     public b(Context arg2)
/*     */     {
/*     */       Object localObject;
/* 183 */       this.a = localObject.getApplicationContext();
/*     */     }
/*     */ 
/*     */     public void run()
/*     */     {
/*     */       try {
/* 189 */         a();
/*     */       } catch (Exception localException) {
/* 191 */         a.a(a.this, null);
/*     */ 
/* 193 */         Log.c("MobclickAgent", "reques update error", localException);
/*     */       }
/*     */     }
/*     */ 
/*     */     public boolean shouldCompressData() {
/* 198 */       return false;
/*     */     }
/*     */ 
/*     */     private void a() {
/* 202 */       JSONObject localJSONObject = a.a(a.this, this.a);
/* 203 */       a.a locala = new a.a(a.this, localJSONObject);
/*     */ 
/* 205 */       b localb = null;
/* 206 */       String[] arrayOfString = g.s;
/* 207 */       for (int i = 0; i < arrayOfString.length; i++) {
/* 208 */         locala.a(arrayOfString[i]);
/* 209 */         localb = (b)execute(locala, b.class);
/* 210 */         if (localb != null)
/*     */         {
/*     */           break;
/*     */         }
/*     */       }
/* 215 */       if (localb == null) {
/* 216 */         a.a(a.this, null);
/*     */ 
/* 218 */         return;
/*     */       }
/*     */ 
/* 221 */       Log.a("MobclickAgent", "response : " + localb.b);
/*     */ 
/* 223 */       if (localb.b)
/*     */       {
/* 225 */         if (a.a(a.this) != null) {
/* 226 */           a.a(a.this).a(localb.c, localb.d);
/*     */         }
/*     */ 
/* 229 */         a.a(a.this, this.a, localb);
/*     */ 
/* 231 */         a.b(a.this, this.a, localb);
/* 232 */         a.a(a.this, localb.a);
/*     */       }
/*     */       else {
/* 235 */         a.a(a.this, null);
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.analytics.onlineconfig.a
 * JD-Core Version:    0.6.2
 */